LiveUser_Admin
[ class tree: LiveUser_Admin ] [ index: LiveUser_Admin ] [ all elements ]

Source for file Rights.php

Documentation is available at Rights.php

  1. <?php require_once 'index.php'?>
  2. <h3>Rights</h3>
  3. <?php
  4. $currentArea $admin->perm->getAreas();
  5. if  (empty($currentArea)) {
  6.     echo 'Run the <b>Area</b> test first<br />';
  7.     exit;
  8. }
  9. // Add
  10. $areas $admin->perm->getAreas();
  11. if ($areas === false{
  12.     echo '<strong>Error on line: '.__LINE__.'</strong><br (>';
  13. }
  14.  
  15. foreach ($areas as $row{
  16.     for ($i = 1; $i < 20; $i++{
  17.         $data = array(
  18.             'area_id' => $row['area_id'],
  19.             'right_define_name' => 'RIGHT_' $row['area_id''_' rand(),
  20.         );
  21.         $rightId $admin->perm->addRight($data);
  22.         if ($rightId === false{
  23.               echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  24.         else {
  25.             echo 'Created Right Id <b>'.$rightId.'</b><br />';
  26.         }
  27.     }
  28. }
  29.  
  30. // Get
  31. $currentRights $admin->perm->getRights();
  32.  
  33. if ($currentRights === false{
  34.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  35. else {
  36.     echo 'These are our current rights:';
  37.     Var_Dump::display($currentRights);
  38.     echo '<br />';
  39. }
  40.  
  41. // Remove
  42. $id array_rand($currentRights);
  43. $filters = array('right_id' => $currentRights[$id]['right_id']);
  44. $rmRight $admin->perm->removeRight($filters);
  45.  
  46. if ($rmRight === false{
  47.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  48. else {
  49.     echo '<b>Right_' $id '</b> was removed<br />';
  50. }
  51.  
  52. // Update
  53. $id array_rand($currentRights);
  54. $data = array('right_define_name' => 'RIGHT_' $id '_UPDATED');
  55. $filters = array('right_id' => $currentRights[$id]['right_id']);
  56. $upRight $admin->perm->updateRight($data$filters);
  57. if ($upRight === false{
  58.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  59. else {
  60.     echo '<b>Right_'$id .'</b> was updated<br />';
  61.     $params = array('filters' => array('right_id' => $currentRights[$id]['right_id']));
  62.     $result $admin->perm->getRights($params);
  63.  
  64.     if ($result === false{
  65.         echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  66.     else {
  67.         Var_Dump::display($result);
  68.     }
  69. }
  70.  
  71. // Get
  72. $currentRights $admin->perm->getRights();
  73.  
  74. if ($currentRights === false{
  75.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  76. else {
  77.     echo 'These are our current rights:';
  78.     Var_Dump::display($currentRights);
  79.     echo '<br />';
  80. }
  81. echo '<hr />';

Documentation generated on Mon, 11 Mar 2019 14:00:09 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.